package demoSingleton;

public class Test {

    public static void main(String[] args) {
        Principal principal1 = Principal.getPrincipal();
        principal1.notice("清明节放假3天！");

        Principal principal2 = Principal.getPrincipal();
        principal2.file("整改全校卫生！");

        System.out.println(principal1 == principal2);
    }

    public static void main2(String[] args) {

        Singleton2 singleton1 = Singleton2.getInstance();
        Singleton2 singleton2 = Singleton2.getInstance();

        System.out.println(singleton1 == singleton2);

    }

    public static void main1(String[] args) {

        Singleton singleton1 = Singleton.getInstance();
        Singleton singleton2 = Singleton.getInstance();

        System.out.println(singleton1 == singleton2);

    }
}
